# 查找src目录下的所有源代码文件
aux_source_directory(../src DIR_SRC)

# 设置库输出目录
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)

# 生成可执行文件
add_executable(CMakeProject1 ${DIR_SRC})

# 根据不同平台设置特定的库目录和链接库
if(WIN32)
    # Windows平台特定设置
    set(THIRD_LIB_PATH ${PROJECT_SOURCE_DIR}/third_lib/win_install)
    set(link_lib glogd gtest jsoncpp)
    # 生成静态库
    add_library(my54library STATIC ${DIR_SRC})
else()
    # Linux平台特定设置
    set(THIRD_LIB_PATH ${PROJECT_SOURCE_DIR}/third_lib/linux_install)
    set(link_lib glog pthread gtest gflags jsoncpp)
    # 生成动态库
    add_library(my54library SHARED ${DIR_SRC})
    target_link_libraries(my54library ${link_lib})
endif()

# 链接库
target_link_libraries(CMakeProject1 ${link_lib})
